package com.lyj.mode.appearance;

/**
 * 家庭影院外观类
 * @author:liyajie
 * @createTime:2022/3/2 14:24
 * @version:1.0
 */
public class HomeTheaterFacade {

    // 聚合各个子系统
    private Player player;

    private Popcorn popcorn;

    private Projector projector;

    private Stereo stereo;

    public HomeTheaterFacade(){

    }

    // 全参构造器
    public HomeTheaterFacade(Player player, Popcorn popcorn,Projector projector,Stereo stereo){
        this.player = player;
        this.popcorn = popcorn;
        this.projector = projector;
        this.stereo = stereo;
    }

    // 准备阶段
    public void ready(){
        popcorn.on();
        player.on();
        projector.on();
        stereo.on();
    }

    // 播放
    public void play(){
        player.select();
        popcorn.pop();
        projector.focus();
        stereo.setVolume();
    }

    // 结束
    public void end(){
        player.off();
        popcorn.off();
        projector.off();
        stereo.off();
    }
}
